package com.example.demo.controller

import com.example.demo.module.Demo
import com.example.demo.module.User
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import java.util.*

/**
 * Created by ${lgs} on 2018/7/23
 */
@RestController
class HelloController {

    /**
     * Spring Boot默认使用的json解析框架是jackson
     */
    @RequestMapping("/getUserInfo")
    fun getUserInfo(): User {
        val user = User("Google", 105, "深圳", "这备注信息")
        user.createTime = Date()
        return user
    }

    @RequestMapping("/getDemo")
    fun getDemo(): Demo {
        val demo = Demo()
        demo.id = 240
        demo.createTime = Date()
        demo.name = "USA"
        demo.remarks = "这是备注信息"
        return demo
    }

    @RequestMapping("/getJapan")
    fun getJapan(): Demo {
        val japan = Demo()
        japan.name = "大日本帝国"
        japan.id = 81
        japan.createTime = Date()
        return japan
    }

    @RequestMapping("/getBritain")
    fun getBritain(): Demo {
        val japan = Demo()
        japan.name = "大英帝国"
        japan.id = 44
        japan.createTime = Date()
        return japan
    }
}